Skip to content

Conversation

@colesbury
Copy link
Contributor

@colesbury colesbury commented Oct 16, 2024

There was a deadlock when ProcessPoolExecutor shuts down at the same time that a queueing thread handles an error processing a task.

Don't use _shutdown_lock to protect the _ThreadWakeup pipes -- use an internal lock instead. This fixes the ordering deadlock where the ExecutorManagerThread holds the _shutdown_lock and joins the queueing thread, while the queueing thread is attempting to acquire the _shutdown_lock while closing the _ThreadWakeup.
(cherry picked from commit 760872e)

…ythonGH-125492)

There was a deadlock when `ProcessPoolExecutor` shuts down at the same
time that a queueing thread handles an error processing a task.

Don't use `_shutdown_lock` to protect the `_ThreadWakeup` pipes -- use
an internal lock instead. This fixes the ordering deadlock where the
`ExecutorManagerThread` holds the `_shutdown_lock` and joins the
queueing thread, while the queueing thread is attempting to acquire the
`_shutdown_lock` while closing the `_ThreadWakeup`.
(cherry picked from commit 760872e)

Co-authored-by: Sam Gross <[email protected]>
@colesbury colesbury merged commit 4256847 into python:3.12 Oct 16, 2024
29 checks passed
@colesbury colesbury deleted the backport-760872e-3.12 branch October 16, 2024 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant